<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>对象的扩展</title>
  </head>
  <body>
    <script>
      // 1.Object.is判断两个值是否完全相等NaN等于NaN，+0不等于-0
      console.log(Object.is(NaN, NaN));
      console.log(Object.is(+0, -0));
      console.log(NaN === NaN);
      console.log(-0 === +0);

      // 2.Object.assign对象的合并覆盖
      const obj1 = {
        name: "xx",
        age: 28,
        height: 178
      };
      const obj2 = {
        name: "faf",
        age: 27,
        sex: "男"
      };
      console.log(Object.assign(obj1, obj2));

      // 3.Object.setPrototypeof设置原型对象 Object.getPrototypeof获取原型对象
      const school = {
        name: "人大"
      };
      const city = {
        xiaoqu: ["北京", "广州", "上海"]
      };
      Object.setPrototypeOf(school, city);
      console.log(Object.getPrototypeOf(school));
      console.log(school);
    </script>
  </body>
</html>
